#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    void rotate(vector<vector<int>>& matrix) {
        int len = matrix.size();
        for (int j = 0; j < len; j++) {
            for (int i = j; i < len - j - 1; i++) {
                int tmp = matrix[i][j];
                swap(tmp, matrix[j][len - i - 1]);
                swap(tmp, matrix[len - i - 1][len - j - 1]);
                swap(tmp, matrix[len - j - 1][i]);
                swap(tmp, matrix[i][j]);
            }
        }

    }
};